
$(document).ajaxError(function (event,xhr,options,exc) {
    if (xhr.status == 400) {
        alert("参数校验失败")
    } else if (xhr.status == 401) {
        alert("用户未登录，即将跳转登录页");
        location.href = "blog_login.html";
    }
});

$(document).ajaxSend(function (e,xhr,opt) {
    var user_token = localStorage.getItem("user_token");
    xhr.setRequestHeader("user_token",user_token);

})

function logout() {
    // 删除 Cookie 即可实现注销
    localStorage.removeItem("user_token");
    alert("您已注销，为您跳转登录页面")
    location.href = "/blog_login.html";
}
